{% extends('layout.html') %}
{% block body %}
<section id="tabs-bar" class="tabsbar">
    <div class="container">
        <div class="row">
            <div class="col s12 m12 l12 xl12">
                <ul class="tabs">
                    <li class="tab col s3 m3 l4 xl2"><a {% if tab=='1' %} class="active" {% endif %} href="#wan_mac"
                            onclick="activeTab(1)">MAC Address</a></li>
                    <li class="tab col s3 m3 l4 xl2"><a {% if tab=='2' %} class="active" {% endif %} href="#wan_ip"
                            onclick="activeTab(2)">IP Address</a></li>
                </ul>
            </div>
        </div>
    </div>
</section>
<section id="wan_mac">
    <div class="container">
        <div class="row">
            <div class="col s12 m4"></div>
            <div class="col s12 m4">
                <div class="card-panel">
                    <h4 class="red-text">WAN Mac Address</h4>
                    <h6>Default MAC: {{interface_settings['mac']['default']}}</h6>
                    <h6>Current MAC: {{interface_settings['mac']['current']}}</h6>
                    <br>
                    <form action="/settings/interface" method="POST">
                        <input type="hidden" name="tab" value="1">
                        <div class="row">
                            <div class="input-field col s12">
                                <input type="text" name="ud_wan_mac" class="validate" placeholder="aa:aa:aa:aa:aa:aa">
                                <label for="">MAC Address</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s0 m2"></div>
                            <div class="input-field col s5 m4 center">
                                <a class="waves-effect waves-light btn modal-trigger col s12" href="#int-modal1"><i
                                        class="material-icons"></i>Update</a>
                                <div id="int-modal1" class="modal">
                                    <div class="modal-content">
                                        <h5 class="red-text">Are you sure you want to change the WAN MAC Address? This
                                            will restart the WAN Interface!</h5>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn waves-effect waves-light">YES</button>
                                        <a class="modal-close waves-effect waves-green btn-flat">Cancel</a>
                                        <input type="hidden" name="wan_mac_update">
                                    </div>
                                </div>
                            </div>
                    </form>
                    <form action="/settings/interface" method="POST">
                        <input type="hidden" name="tab" value="1">
                        <div class="input-field col s5 m4 center">
                            <a class="waves-effect waves-light btn modal-trigger col s12" href="#int-modal2"><i
                                    class="material-icons"></i>Restore</a>
                            <div id="int-modal2" class="modal">
                                <div class="modal-content">
                                    <h5 class="red-text">Are you sure you want to restore the default WAN MAC Address?
                                        This will restart the WAN Interface!</h5>
                                </div>
                                <div class="modal-footer">
                                    <button class="btn waves-effect waves-light">YES</button>
                                    <a class="modal-close waves-effect waves-green btn-flat">Cancel</a>
                                    <input type="hidden" name="wan_mac_restore">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    </div>
</section>
<section id="wan_ip">
    <div class="container">
        <div class="row">
            <div class="col s12 m3"></div>
            <div class="col s12 m6">
                <div class="card-panel">
                    <h4 class="red-text">WAN IP Address</h4>
                    <h6>IP: {{interface_settings['ip']['ip_address']}}</h6>
                    <h6>Netmask: {{interface_settings['ip']['netmask']}}</h6>
                    <h6>Gateway: {{interface_settings['ip']['default_gateway']}}</h6>
                    <br>
                    <form action="/settings/interface" method="POST">
                        <input type="hidden" name="tab" value="2">
                        <div class="row">
                            <div class="input-field col s9 m9">
                                <input type="text" name="ud_wan_ip" class="validate" placeholder="192.168.1.11">
                                <label for="">IP Address</label>
                            </div>
                            <div class="input-field col s3 m3">
                                <select name="ud_wan_cidr" id="">
                                    {% for i in range(24,31) %}
                                    <option value="{{i}}">/{{i}}</option>
                                    {% endfor %}
                                </select>
                                <label for="ud_wan_cidr">Netmask</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s12">
                                <input type="text" name="ud_wan_dfg" class="validate" placeholder="192.168.1.1">
                                <label for="">Default Gateway</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s0 m2"></div>
                            <div class="input-field col s5 m3 center">
                                <a class="waves-effect waves-light btn modal-trigger col s12" href="#int-modal3"><i
                                        class="material-icons"></i>Update</a>
                                <div id="int-modal3" class="modal">
                                    <div class="modal-content">
                                        <h5 class="red-text">Are you sure you want to change the WAN IP Address? This
                                            will restart the WAN Interface and the IPS Module!</h5>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn waves-effect waves-light">YES</button>
                                        <a class="modal-close waves-effect waves-green btn-flat">Cancel</a>
                                        <input type="hidden" name="wan_ip_update">
                                    </div>
                                </div>
                            </div>
                            <div class="input-field col s5 m6 center">
                                <br>
                                <div class="switch">
                                    <label>
                                        DHCP
                                        {% if interface_settings['ip']['dhcp'] %}
                                        <input type="checkbox" name="static_wan">
                                        {% else %}
                                        <input type="checkbox" checked="checked" name="static_wan">
                                        {% endif %}
                                        <span class="lever"></span>
                                        Static
                                    </label>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}